package com.renhua.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import de.greenrobot.dao.AbstractDaoMaster;
import de.greenrobot.dao.identityscope.IdentityScopeType;

import com.renhua.database.ChartsDao;
import com.renhua.database.plazaMsgDao;
import com.renhua.database.FriendsAchieveMsgDao;
import com.renhua.database.FriendsDao;
import com.renhua.database.ContractsDao;
import com.renhua.database.PaymentAccountDao;
import com.renhua.database.NaviMsgDao;
import com.renhua.database.CollectionInfoDao;
import com.renhua.database.UsersDao;
import com.renhua.database.WindowCoEntityDao;
import com.renhua.database.CoDonateDao;
import com.renhua.database.CoDonateDetailImgDao;
import com.renhua.database.WinCoinIncomeHistoryDao;
import com.renhua.database.DonateHistoryDao;
import com.renhua.database.ConvertHistoryDao;
import com.renhua.database.MyEffortsDao;
import com.renhua.database.cacheImgsDao;
import com.renhua.database.AdvDataBaseDao;
import com.renhua.database.AdvDataBase2Dao;
import com.renhua.database.CategoryDao;
import com.renhua.database.DownloadDao;
import com.renhua.database.RecommendAdvPojoDataBaseDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * Master of DAO (schema version 43): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
    public static final int SCHEMA_VERSION = 43;

    /** Creates underlying database table using DAOs. */
    public static void createAllTables(SQLiteDatabase db, boolean ifNotExists) {
        ChartsDao.createTable(db, ifNotExists);
        plazaMsgDao.createTable(db, ifNotExists);
        FriendsAchieveMsgDao.createTable(db, ifNotExists);
        FriendsDao.createTable(db, ifNotExists);
        ContractsDao.createTable(db, ifNotExists);
        PaymentAccountDao.createTable(db, ifNotExists);
        NaviMsgDao.createTable(db, ifNotExists);
        CollectionInfoDao.createTable(db, ifNotExists);
        UsersDao.createTable(db, ifNotExists);
        WindowCoEntityDao.createTable(db, ifNotExists);
        CoDonateDao.createTable(db, ifNotExists);
        CoDonateDetailImgDao.createTable(db, ifNotExists);
        WinCoinIncomeHistoryDao.createTable(db, ifNotExists);
        DonateHistoryDao.createTable(db, ifNotExists);
        ConvertHistoryDao.createTable(db, ifNotExists);
        MyEffortsDao.createTable(db, ifNotExists);
        cacheImgsDao.createTable(db, ifNotExists);
        AdvDataBaseDao.createTable(db, ifNotExists);
        AdvDataBase2Dao.createTable(db, ifNotExists);
        CategoryDao.createTable(db, ifNotExists);
        DownloadDao.createTable(db, ifNotExists);
        RecommendAdvPojoDataBaseDao.createTable(db, ifNotExists);
    }
    
    /** Drops underlying database table using DAOs. */
    public static void dropAllTables(SQLiteDatabase db, boolean ifExists) {
        ChartsDao.dropTable(db, ifExists);
        plazaMsgDao.dropTable(db, ifExists);
        FriendsAchieveMsgDao.dropTable(db, ifExists);
        FriendsDao.dropTable(db, ifExists);
        ContractsDao.dropTable(db, ifExists);
        PaymentAccountDao.dropTable(db, ifExists);
        NaviMsgDao.dropTable(db, ifExists);
        CollectionInfoDao.dropTable(db, ifExists);
        UsersDao.dropTable(db, ifExists);
        WindowCoEntityDao.dropTable(db, ifExists);
        CoDonateDao.dropTable(db, ifExists);
        CoDonateDetailImgDao.dropTable(db, ifExists);
        WinCoinIncomeHistoryDao.dropTable(db, ifExists);
        DonateHistoryDao.dropTable(db, ifExists);
        ConvertHistoryDao.dropTable(db, ifExists);
        MyEffortsDao.dropTable(db, ifExists);
        cacheImgsDao.dropTable(db, ifExists);
        AdvDataBaseDao.dropTable(db, ifExists);
        AdvDataBase2Dao.dropTable(db, ifExists);
        CategoryDao.dropTable(db, ifExists);
        DownloadDao.dropTable(db, ifExists);
        RecommendAdvPojoDataBaseDao.dropTable(db, ifExists);
    }
    
    public static abstract class OpenHelper extends SQLiteOpenHelper {

        public OpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory, SCHEMA_VERSION);
        }

        @Override
        public void onCreate(SQLiteDatabase db) {
            Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
            createAllTables(db, false);
        }
    }
    
    /** WARNING: Drops all table on Upgrade! Use only during development. */
    public static class DevOpenHelper extends OpenHelper {
        public DevOpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory);
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
            Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
            dropAllTables(db, true);
            onCreate(db);
        }
    }

    public DaoMaster(SQLiteDatabase db) {
        super(db, SCHEMA_VERSION);
        registerDaoClass(ChartsDao.class);
        registerDaoClass(plazaMsgDao.class);
        registerDaoClass(FriendsAchieveMsgDao.class);
        registerDaoClass(FriendsDao.class);
        registerDaoClass(ContractsDao.class);
        registerDaoClass(PaymentAccountDao.class);
        registerDaoClass(NaviMsgDao.class);
        registerDaoClass(CollectionInfoDao.class);
        registerDaoClass(UsersDao.class);
        registerDaoClass(WindowCoEntityDao.class);
        registerDaoClass(CoDonateDao.class);
        registerDaoClass(CoDonateDetailImgDao.class);
        registerDaoClass(WinCoinIncomeHistoryDao.class);
        registerDaoClass(DonateHistoryDao.class);
        registerDaoClass(ConvertHistoryDao.class);
        registerDaoClass(MyEffortsDao.class);
        registerDaoClass(cacheImgsDao.class);
        registerDaoClass(AdvDataBaseDao.class);
        registerDaoClass(AdvDataBase2Dao.class);
        registerDaoClass(CategoryDao.class);
        registerDaoClass(DownloadDao.class);
        registerDaoClass(RecommendAdvPojoDataBaseDao.class);
    }
    
    public DaoSession newSession() {
        return new DaoSession(db, IdentityScopeType.Session, daoConfigMap);
    }
    
    public DaoSession newSession(IdentityScopeType type) {
        return new DaoSession(db, type, daoConfigMap);
    }
    
}
